package cc.owoo.godpen.analysis.css;

import cc.owoo.godpen.analysis.html.Element;

import java.util.Queue;

/**
 * 选择元素后面的所有兄弟元素
 * Created by nimensei
 * 2022-06-05 下午 08:24
 */
public class BrothersSelector extends SelectorNode {
    @Override
    void selectElement(Element element, Queue<Element> elements) {
        while ((element = element.getNext()) != null)
            elements.add(element);
    }

    @Override
    void matchingElement(Element element, Queue<Element> elements) {
        selectElement(element, elements);
    }

    @Override
    public void stringify(StringBuilder string) {
        string.append('~');
    }
}
